package com.xqt.controller;

import com.xqt.entity.User;
import com.xqt.entity.sys.SysMenu;
import com.xqt.service.SysMenuService;
import com.xqt.service.UserService;
import com.xqt.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2017/3/10.
 */
@RestController
@RequestMapping(value = "rest")
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private SysMenuService sysMenuService;

    @Autowired
    UserServiceImpl userServiceImpl;

    @RequestMapping(value="/user",method = RequestMethod.GET)
    public String userInfo(){
        List userList=userService.getUser();
        return "hello";
    }

    @RequestMapping(value="/user2",method = RequestMethod.GET)
    public User user(){
        User user=new User();
       return userServiceImpl.gerUser();
    }

    @RequestMapping(value="/testcache",method = RequestMethod.GET)
    public String tsfasrf(){
        return userService.test(1);
    }

    @RequestMapping(value="/delete",method = RequestMethod.GET)
    public String deletecache(){
        userService.delete();
        return "delete";
    }

    @RequestMapping(value="/testspeed")
    public SysMenu testSpeed(){
        long startTime = System.currentTimeMillis();    //获取开始时间
        long endTime = System.currentTimeMillis();    //获取结束时间
        System.out.println("程序运行时间：" + (endTime - startTime) + "ms");
        return sysMenuService.queryById("177110c3-b6f5-4ac7-8905-b9ea50dc39ad");
    }
}
